package es

import (
	"fmt"
	"github.com/elastic/go-elasticsearch"
	"week2a/models/global"
)

func InitEs() {
	err := global.Err
	cfg := elasticsearch.Config{
		Addresses: []string{
			"http://121.36.228.151:9200",
		},
	}
	global.EsDB, err = elasticsearch.NewClient(cfg)
	if err != nil {
		fmt.Println("es 链接失败", err)
		return
	}
	fmt.Println("es 链接成功", cfg)

	// ...
}
